<!--  -->
<template>
  <div>
    <h3>和：{{sum}}</h3>
    <select>
      <option value="1">1</option>
      <option value="2">2</option>
      <option value="3">3</option>
    </select>
    <button @click="add">+</button>
    <button @click="jiAdd">遇到奇数相加</button>
    <button @click="waitAdd">等一等加</button>
  </div>
</template>

<script>
export default {
  name:'Com',
  data () {
    return {
      sum:0,
      n:1
    };
  },

  components: {},

  computed: {},

  mounted(){},

  methods:{
    add(){
      this.sum+=this.n
    },
    jiAdd(){
      if(this.sum%2){
        this.sum+=this.n
      }
    },
    waitAdd(){
      setTimeout(()=>{
        this.sum+=this.n
      },1000)
    }
  },
  watch: {},
  mixins: []
}

</script>
<style  scoped>
</style>